package enumeration;

/**
 * A Java enum switch statement example (a switch/case statement example).
 * @author alvin alexander, devdaily.com
 *
 */
public class JavaEnumSwitchCaseExample
{

  enum Margin
  {
    TOP, RIGHT, BOTTOM, LEFT
  }

  public static void main(String[] args)
  {
    System.out.println(getMarginValue(Margin.TOP));
  }

  /**
   * @param A valid Margin value.
   * @return A String representing the value for the given Margin,
   *         or null if the Margin is not valid.
   */
  public static String getMarginValue(Margin margin)
  {
    // use the enum values in our switch statement here
    switch (margin)
    {
      case TOP:     return "1em";
      case RIGHT:   return "12px";
      case BOTTOM:  return "1.5em";
      case LEFT:    return "6px";
      default:      return null;
    }
  }
  
}
